import React,{Fragment} from 'react'
import { View, Text, Image, ScrollView,Swiper,SwiperItem} from '@tarojs/components'

function MustBuy ({mustBuyList}) {
  return (
    <View className='must_buy'>
        <Text className='buy_top'>今日必买</Text>
        <Image className='yjiant' src={require('../../../static/images/yjiant.png')} />
        {/*滚动区*/}
      <Swiper
        className='must_buy_swiper'
        vertical
        circular
        interval={2000}
        autoplay>

        {
          mustBuyList.map((item, index) => {
            return (
              <SwiperItem className='must_buy_swiper_it'>
                {
                  item.map((v,index) => {
                   return (
                     <View className='buy_swiper_it'>
                       <Image className='buy_swiper_it_img' src={v.buyimg} />
                       <Text className='buy_swiper_it_zk'>{v.discount}</Text>
                     </View>
                   )
                  })
                }
              </SwiperItem>
            )
          })
        }

        {/*{*/}
        {/*  mustBuyList.map((item, index) => {*/}
        {/*    return (*/}
        {/*      item.map((v,index) => {*/}
        {/*        return (*/}
        {/*          <SwiperItem className='must_buy_swiper_it'>*/}
        {/*            <View className='buy_swiper_it'>*/}
        {/*              <Image className='buy_swiper_it_img' src={require('../../../static/images/moguj.png')} />*/}
        {/*              <Text className='buy_swiper_it_zk'>{v.discount}</Text>*/}
        {/*            </View>*/}
        {/*          </SwiperItem>*/}
        {/*        )*/}
        {/*      })*/}
        {/*    )*/}
        {/*  })*/}
        {/*} */}

      </Swiper>


      {/*<ScrollView*/}
      {/*  enableFlex*/}
      {/*  scrollX*/}
      {/*  className='buy_scroll'*/}
      {/*>*/}
      {/*  {*/}
      {/*    mustBuyList.map((item,index) => {*/}
      {/*      return (*/}
      {/*        <View key={index} className='buy_scroll_item'>*/}
      {/*          <Image className='buy_img' src={item.buyimg}  />*/}
      {/*          <Text className='buy_disc'>{item.discount}</Text>*/}
      {/*        </View>*/}
      {/*      )*/}
      {/*    })*/}
      {/*  }*/}
      {/*</ScrollView>*/}
    </View>
  )
}

export default MustBuy
